// pages/mos/mos.js
var app = getApp();
Page({

   /**
    * 页面的初始数据
    */
   data: {
      radioItems: [
         { name: ' 0-15 分钟  ', names: '16-30 分钟', namess: '31-45 分钟', namesss: '46-60 分钟', namessss: ' 60分钟以上', },
      ],
      radioItemss: [
         {
   name: ' A  ', names: 'B', namess: 'C', namesss: 'D', namessss: 'E', namesssss: 'F',
            id:0,
            active:'active'
         },
      ],
      first:0,
      one:0,
      two:0,
      three:0,
      four:0,
      five:0,
      six:0,
      seven:0,
      eight:0,
      nine:0,
      ten:0,
      hours:0,
   },

   // tab切换(大一题)
   tabFun: function (e) {
      //获取触发事件组件的dataset属性 
    var first = e.target.dataset.id;
    this.setData({
        first: first,
    });
   },

   // tab切换 1
   tabOne: function (e) {
      //获取触发事件组件的dataset属性 
      var one = e.target.dataset.id;
      console.log(one);``
      this.setData({
        one: one
      });
   },

   // tab切换2
   tabTwo: function (e) {
      //获取触发事件组件的dataset属性 
     var two = e.target.dataset.id;
     this.setData({
       two: two
     });
   },
   // tab切换3
   tabThree: function (e) {
      //获取触发事件组件的dataset属性 
     var three = e.target.dataset.id;
     this.setData({
       three: three
     });
   },

   // tab切换4
   tabFour: function (e) {
      //获取触发事件组件的dataset属性 
     var four = e.target.dataset.id;
     this.setData({
       four: four
     });
   },

   // tab切换5
   tabFive: function (e) {
      //获取触发事件组件的dataset属性 
     var five = e.target.dataset.id;
     this.setData({
       five: five
     });
   },

   // tab切换6
   tabSix: function (e) {
      //获取触发事件组件的dataset属性 
     var six = e.target.dataset.id;
     this.setData({
       six: six
     });
   },
   // tab切换7
   tabSeven: function (e) {
      //获取触发事件组件的dataset属性 
     var seven = e.target.dataset.id;
     this.setData({
       seven: seven
     });
   },

   // tab切换8
   tabEight: function (e) {
      //获取触发事件组件的dataset属性 
     var eight = e.target.dataset.id;
     this.setData({
       eight: eight
     });
   },
   // tab切换9
   tabNine: function (e) {
      //获取触发事件组件的dataset属性 
     var nine = e.target.dataset.id;
     this.setData({
       nine: nine
     });
   },
   // tab切换10
   tabTen: function (e) {
      //获取触发事件组件的dataset属性 
     var ten = e.target.dataset.id;
     this.setData({
       ten: ten
     });
   },

   // tab切换10
   tabFunnsssf: function (e) {
      //获取触发事件组件的dataset属性 
     var ten = e.target.dataset.id;
     this.setData({
       ten: ten
     });
   },

   bindHours: function (e) {
     this.setData({
       hours: e.detail.value
     })
   },

   //数据提交
   tijiao: function () {
     var that = this;
     wx.request({
       url: app.api.hostUrl + '/Api/User/research',
       method: 'post',
       data: {
         uid: app.api.userId,
         first: that.data.first,
         one: that.data.one,
         two: that.data.two,
         three: that.data.three,
         four: that.data.four,
         five: that.data.five,
         six: that.data.six,
         seven: that.data.seven,
         eight: that.data.eight,
         nine: that.data.nine,
         ten: that.data.ten,
         hours: that.data.hours,
       },
       header: {
         'Content-Type': 'application/x-www-form-urlencoded'
       },
       success: function (res) {
         var status = res.data.status;
         var price = that.data.price;
         if (status == 1) {
           wx.showToast({
             title: '提交成功，感谢您的参与！',
             duration: 2000
           });
         } else {
           wx.showToast({
             title: res.data.err,
             duration: 2000
           });
         }
       },
       fail: function (e) {
         wx.showToast({
           title: '网络异常！',
           duration: 2000
         });
       },
     })
   },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {

   },

   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {

   },

   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {

   },

   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide: function () {

   },

   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload: function () {

   },

   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {

   },

   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {

   },

   /**
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {

   }
})